/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version 2.0;
    format ascii;
    class dictionary;
    location system;
    object snappyHexMeshDict;
}

    castellatedMesh true;
    snap true;
    addLayers true;
    geometry
    {
        hull.stl
        {
            type triSurfaceMesh;
            name hull;
            
            patchInfo
            {
                type wall;
            }
        }
        stern 
        {
            type searchableBox;
            min ( 5.0 -0.6  -0.6);
            max ( 8.0  0.6  0.1);
        }
        
        wake
        {
            type searchableBox;
            min (-1.0 -0.8 -0.8);
            max ( 12.0 0.8  0.1);
        }
        
        propeller
        {
            type            searchableCylinder;
            point1          (6.8 0 -0.282898);
            point2          (7.0 0 -0.282898);
            radius          0.15;
        }

        wake1
        {
            type searchableBox;
            min ( 10.0 -0.8 -0.8);
            max ( 50.0 0.8  0.1);
        }

    }

    castellatedMeshControls
    {
        features
        (
            {
                file "hull_line0.eMesh";
                level 6;
            }
            {
                file "hull_line1.eMesh";
                level 8;
            }
        );
        
        refinementSurfaces
        {
            hull
            {
                level (6 6);
            }

        }

        refinementRegions
        {
            stern
            {
                mode inside;
                levels ((4 4));
            }
            
            wake
            {
                mode inside;
                levels ((3 3));
            }
            wake1
            {
                mode inside;
                levels ((2 2));
            }  

            propeller
            {
                mode inside;
                levels ((7 7));
            }
            
        }

        locationInMesh ( 20.0 0.0 0.0);
        maxLocalCells  10000000;
        maxGlobalCells 50000000;
        minRefinementCells 0;
        nCellsBetweenLevels 3;
        resolveFeatureAngle 10;
        allowFreeStandingZoneFaces false;
        planarAngle 30;
        maxLoadUnbalance 0.10;
    }

    snapControls
    {
        nSolveIter 100;
        nSmoothPatch 3;
        tolerance 1.5;
        nRelaxIter 5;
        nFeatureSnapIter 10;
        implicitFeatureSnap false;
        explicitFeatureSnap true;
        multiRegionFeatureSnap false;
    }

    addLayersControls
    {
        layers
        {
            "hull"
            {nSurfaceLayers 5;}
        }

        relativeSizes true;
        expansionRatio 1.3;
        finalLayerThickness 0.4;
        minThickness 0.0001;
        nGrow 0;
        featureAngle 180;
        slipFeatureAngle 80;
        nRelaxIter 5;
        nSmoothSurfaceNormals 1;
        nSmoothNormals 3;
        nSmoothThickness 10;
        maxFaceThicknessRatio 0.9;
        maxThicknessToMedialRatio 0.3;
        minMedialAxisAngle 90;
        nBufferCellsNoExtrude 0;
        nLayerIter 50;
        nRelaxedIter 20;
        writeVTK false;
        noErrors false;
        layerRecovery 1;
        growZoneLayers false;
        projectGrownUp 0.0;
    }

    meshQualityControls
    {
        maxNonOrtho 65;
        maxBoundarySkewness 4;
        maxInternalSkewness 4;
        maxConcave 180;
        minFlatness 0.5;
        minVol 1.00E-13;
        minArea -1;
        minTetQuality 1e-30;
        minTwist 0.01;
        minDeterminant 0.01;
        minFaceWeight 0.01;
        minVolRatio 0.01;
        minTriangleTwist -1;
        nSmoothScale 4;
        errorReduction 0.75;
    }

    debug 0;
    mergeTolerance 1E-6;
    autoBlockMesh false;
